<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-ui-1.8.17.custom.min.js"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/pmgr/css/jquery/i18n/jquery.ui.datepicker-ko.js"></script>

<link rel="stylesheet" href="${pageContext.request.contextPath}/pmgr/css/jquery/themes/ui-lightness/jquery.ui.all.css">

<script type="text/javascript">

$(document).ready(function(){
	$( "#src_sdate, #src_edate" ).datepicker({
	// 		dateFormat: 'yy.mm.dd',
	 		changeMonth: true,
	 		changeYear: true,
	 		showOn: 'button',
	 		buttonImageOnly: true,
	 		buttonImage: "/pmgr/images/icon_calendar.gif"
	 	});
});

//데이터 저장
function goNextPage(type,p_rm_no, p_p_id, p_re_no){
	if("1"==type){
		//입금대기현황
		$.popUrl("/usr/pe/re/pere705Q.do?rm_no="+p_rm_no+"&p_id="+p_p_id,"800","730","peti900Q");	
	}else if("2"==type){
		//예약현황
		$.popUrl("/usr/pe/re/pere1200Q.do?p_id="+p_p_id,"800","730","peti900Q");
	}else if("3"==type){
		//예약완료현황
		$.popUrl("/usr/pe/re/pere706Q.do?rm_no="+p_rm_no+"&p_id="+p_p_id,"800","730","peti900Q");
	}else if("4"==type){
		//환불요청
		$.popUrl("/usr/pe/re/pere702Q.do?re_no="+p_re_no+"&p_id="+p_p_id,"800","730","peti900Q");
	}else if("5"==type){
		//미입금취소
		$.popUrl("/usr/pe/re/pere707Q.do?rm_no="+p_rm_no+"&p_id="+p_p_id,"800","730","peti900Q");
	}else if("6"==type){
		//예약종합관리
		$.popUrl("/usr/pe/re/pere700Q.do?p_id="+p_p_id,"800","730","peti900Q");
	}
	
	
}


</script>

<table width="800" border="0" cellspacing="1" cellpadding="2"
	class="class_admin_table_nocolor">
	<tr>
		<td height="25" width="350"><font color="brown">예약관리 ▶
				예약목록</font></td>
		<td height="25" width="450" align="left">&nbsp;
		<td align="right">&nbsp;</td>
		</td>
	</tr>
</table>
<br>

<form name="search" action="./peti900Q.do">
<table width="1200" border="0" cellspacing="1" cellpadding="2">
		<tr>
			<td align="left">총 : ${paginationInfo.totalRecordCount } 건 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 예약기간
				<input type="text" name="src_sdate" id="src_sdate" value="${param.src_sdate }" size="10">
				~ <input type="text" name="src_edate" id="src_edate" value="${param.src_edate }" size="10">
				검색어 <select name="src_condition">
					<option value="1"  <c:if test="${'1'==param.src_condition }">selected="selected"</c:if>>이름</option>
					<option value="2" <c:if test="${'2'==param.src_condition }">selected="selected"</c:if>>펜션명</option>
			</select> <input name="src_val" value="${param.src_val }" size="30"> <input type=submit
				value="찾기">
			</td>

			<td align="right">&nbsp;</td>
		</tr>
</table>
</form>
<table width="1200" border="0" cellspacing="1" cellpadding="2"
	class="class_admin_table">
	<tr height="25" class="class_admin_table_head">
		<td align="center">번호</td>
		<td align="center">상태</td>
		<td align="center">예약</td>
		<td align="center">펜션명</td>
		<td align="center">입실일</td>
		<td align="center">예약자명</td>
		<td align="center">핸드폰</td>
		<td align="center">이용요금</td>
		<td align="center">결제금액</td>
		<td align="center">결제방법</td>
		<td align="center">결제일</td>
		<td align="center">등록일시</td>
		<td align="center">마감일시</td>
		<td align="center">완료취소시간</td>
	</tr>
<c:if test="${list !=null && fn:length(list)>0 }">
	<c:forEach var="map" items="${list}" varStatus="status">
		<c:if test="${(!empty map.cancel_info && ''!=map.cancel_info) && (!empty map.reservation_info && ''!=map.reservation_info) }">
<!-- 		예약정보 -->
	<tr height="25"	class="class_admin_table_blank">
		<td align="center">${paginationInfo.nowCnt -status.index}</td>
		<td align="center">
			<c:set var="fnParam" value="1"/>
			<c:if test="${!empty map.reservation_info && ''!=map.reservation_info}">
				<c:if test="${'R'==map.rc_status }">입금대기
					<c:set var="fnParam" value="1"/>
				</c:if>
				<c:if test="${'C'==map.rc_status }">입금완료
					<c:set var="fnParam" value="3"/>
				</c:if>
			</c:if>
			<c:if test="${!empty map.cancel_info && ''!=map.cancel_info}">
				<c:if test="${'R'==map.cc_re_status }">환불대기
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${'C'==map.cc_re_status }">환불완료
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${(empty map.cc_re_status || ''==map.cc_re_status) &&  'D'==map.cc_status}">미입금취소
					<c:set var="fnParam" value="5"/>
				</c:if>
			</c:if>
		</td>
		<td align="center">
			<a href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.cc_re_no }')"><font	color="#bd3565"><u>[예약정보]</u></font></a>
			&nbsp;<a	href="javascript:goNextPage('2','${map.rm_no }','${map.p_id }','')">
			<font color="#bd3565"><u>[달력]</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${map.p_nm }</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${fn:substring(map.reservation_dt,0,4)}-${fn:substring(map.reservation_dt,4,6)}-${fn:substring(map.reservation_dt,6,8)}</u></font></a></td>
		<td align="left"><a
			href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.cc_re_no }')"><u>${map.reservation_nm }</u></a>
			<c:if test="${'A'==map.add_type }">
				<span style="color: green">[관리자]</span>
			</c:if>
		</td>
		<td align="left">${map.r_phone1 }-${map.r_phone2 }-${map.r_phone3 }</td>
		<td align="right"><fmt:formatNumber value="${map.rc_pay }" pattern="#,###"/></td>
		<td align="right"><fmt:formatNumber value="${map.rc_pay-map.cc_pay }" pattern="#,###"/></td>
		<td align="center">BANK</td>
		<td align="center">
			<c:if test="${!empty map.rc_c_reg_dt && ''!=map.rc_c_reg_dt }">
				${fn:substring(map.rc_c_reg_dt,0,4)}-${fn:substring(map.rc_c_reg_dt,4,6)}-${fn:substring(map.rc_c_reg_dt,6,8)}
			</c:if>
		</td>
		<td align="center">${fn:substring(map.reg_dt,0,4)}-${fn:substring(map.reg_dt,4,6)}-${fn:substring(map.reg_dt,6,8)} ${fn:substring(map.reg_dt,8,10)}:${fn:substring(map.reg_dt,10,12)}</td>
		<td align="center">${fn:substring(map.rm_wait_time,0,4)}-${fn:substring(map.rm_wait_time,4,6)}-${fn:substring(map.rm_wait_time,6,8)} ${fn:substring(map.rm_wait_time,8,10)}:${fn:substring(map.rm_wait_time,10,12)}</td>
		<td align="center">
			<c:if test="${!empty map.sc_dt && ''!=map.sc_dt }">
				완.${fn:substring(map.sc_dt,0,4)}-${fn:substring(map.sc_dt,4,6)}-${fn:substring(map.sc_dt,6,8)} ${fn:substring(map.sc_dt,8,10)}:${fn:substring(map.sc_dt,10,12)}
			</c:if>
			<c:if test="${!empty map.cc_sc_dt && ''!=map.cc_sc_dt }">
				취.${fn:substring(map.cc_sc_dt,0,4)}-${fn:substring(map.cc_sc_dt,4,6)}-${fn:substring(map.cc_sc_dt,6,8)} ${fn:substring(map.cc_sc_dt,8,10)}:${fn:substring(map.cc_sc_dt,10,12)}
			</c:if>
			
		</td>
	</tr>
<!-- 	환불정보 -->
	<tr height="25"	class="class_admin_table_cancel">
		<td align="center">&nbsp;</td>
		<td align="center">
			<c:set var="fnParam" value="1"/>
			<c:if test="${!empty map.cancel_info && ''!=map.cancel_info}">
				<c:if test="${'R'==map.c_cc_re_status }">환불대기
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${'C'==map.c_cc_re_status }">환불완료
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${(empty map.c_cc_re_status || ''==map.c_cc_re_status) &&  'D'==map.cc_status}">미입금취소
					<c:set var="fnParam" value="5"/>
				</c:if>
			</c:if>
		</td>
		<td align="center">
			<a href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.c_cc_re_no }')"><font	color="#bd3565"><u>[예약정보]</u></font></a>
			&nbsp;<a	href="javascript:goNextPage('2','${map.rm_no }','${map.p_id }','')">
			<font color="#bd3565"><u>[달력]</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${map.p_nm }</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${fn:substring(map.reservation_dt,0,4)}-${fn:substring(map.reservation_dt,4,6)}-${fn:substring(map.reservation_dt,6,8)}</u></font></a></td>
		<td align="left"><a
			href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.c_cc_re_no }')"><u>${map.reservation_nm }</u></a>
			<c:if test="${'A'==map.add_type }">
				<span style="color: green">[관리자]</span>
			</c:if>
		</td>
		<td align="left">${map.r_phone1 }-${map.r_phone2 }-${map.r_phone3 }</td>
		<td align="right"><fmt:formatNumber value="${map.c_rc_pay }" pattern="#,###"/></td>
		<td align="right"><fmt:formatNumber value="${map.c_rc_pay-map.c_cc_pay }" pattern="#,###"/></td>
		<td align="center">BANK</td>
		<td align="center">

		</td>
		<td align="center">${fn:substring(map.reg_dt,0,4)}-${fn:substring(map.reg_dt,4,6)}-${fn:substring(map.reg_dt,6,8)} ${fn:substring(map.reg_dt,8,10)}:${fn:substring(map.reg_dt,10,12)}</td>
		<td align="center">${fn:substring(map.rm_wait_time,0,4)}-${fn:substring(map.rm_wait_time,4,6)}-${fn:substring(map.rm_wait_time,6,8)} ${fn:substring(map.rm_wait_time,8,10)}:${fn:substring(map.rm_wait_time,10,12)}</td>
		<td align="center">
			<c:if test="${!empty map.c_cc_sc_dt && ''!=map.c_cc_sc_dt }">
				취.${fn:substring(map.c_cc_sc_dt,0,4)}-${fn:substring(map.c_cc_sc_dt,4,6)}-${fn:substring(map.c_cc_sc_dt,6,8)} ${fn:substring(map.c_cc_sc_dt,8,10)}:${fn:substring(map.c_cc_sc_dt,10,12)}
			</c:if>
			
		</td>
	</tr>
		</c:if>
		<c:if test="${!((!empty map.cancel_info && ''!=map.cancel_info) && (!empty map.reservation_info && ''!=map.reservation_info)) }">
<!-- 		환불이나 완료 하나만 있을대 -->
	<tr height="25"
		<c:if test="${!empty map.cancel_info && ''!=map.cancel_info}">class="class_admin_table_cancel"</c:if> 
		<c:if test="${!empty map.reservation_info && ''!=map.reservation_info}">class="class_admin_table_blank"</c:if>
	>
		<td align="center">${paginationInfo.nowCnt -status.index}</td>
		<td align="center">
			<c:set var="fnParam" value="1"/>
			<c:if test="${!empty map.reservation_info && ''!=map.reservation_info}">
				<c:if test="${'R'==map.rc_status }">입금대기
					<c:set var="fnParam" value="1"/>
				</c:if>
				<c:if test="${'C'==map.rc_status }">입금완료
					<c:set var="fnParam" value="3"/>
				</c:if>
			</c:if>
			<c:if test="${!empty map.cancel_info && ''!=map.cancel_info}">
				<c:if test="${!empty map.reservation_info && ''!=map.reservation_info}">
				,
				</c:if>
				<c:if test="${'R'==map.cc_re_status }">환불대기
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${'C'==map.cc_re_status }">환불완료
					<c:set var="fnParam" value="4"/>
				</c:if>
				<c:if test="${(empty map.cc_re_status || ''==map.cc_re_status) &&  'D'==map.cc_status}">미입금취소
					<c:set var="fnParam" value="5"/>
				</c:if>
			</c:if>
		</td>
		<td align="center">
			<a href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.cc_re_no }')"><font	color="#bd3565"><u>[예약정보]</u></font></a>
			&nbsp;<a	href="javascript:goNextPage('2','${map.rm_no }','${map.p_id }','')">
			<font color="#bd3565"><u>[달력]</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${map.p_nm }</u></font></a></td>
		<td align="center"><a
			href="javascript:goNextPage('6','${map.rm_no }','${map.p_id }')"><font
				color="#bd3565"><u>${fn:substring(map.reservation_dt,0,4)}-${fn:substring(map.reservation_dt,4,6)}-${fn:substring(map.reservation_dt,6,8)}</u></font></a></td>
		<td align="left"><a
			href="javascript:goNextPage('${fnParam }','${map.rm_no }','${map.p_id }','${map.cc_re_no }')"><u>${map.reservation_nm }</u></a>
			<c:if test="${'A'==map.add_type }">
				<span style="color: green">[관리자]</span>
			</c:if>
		</td>
		<td align="left">${map.r_phone1 }-${map.r_phone2 }-${map.r_phone3 }</td>
		<td align="right"><fmt:formatNumber value="${map.rc_pay }" pattern="#,###"/></td>
		<td align="right"><fmt:formatNumber value="${map.rc_pay-map.cc_pay }" pattern="#,###"/></td>
		<td align="center">BANK</td>
		<td align="center">
			<c:if test="${!empty map.rc_c_reg_dt && ''!=map.rc_c_reg_dt }">
				${fn:substring(map.rc_c_reg_dt,0,4)}-${fn:substring(map.rc_c_reg_dt,4,6)}-${fn:substring(map.rc_c_reg_dt,6,8)}
			</c:if>
		</td>
		<td align="center">${fn:substring(map.reg_dt,0,4)}-${fn:substring(map.reg_dt,4,6)}-${fn:substring(map.reg_dt,6,8)} ${fn:substring(map.reg_dt,8,10)}:${fn:substring(map.reg_dt,10,12)}</td>
		<td align="center">${fn:substring(map.rm_wait_time,0,4)}-${fn:substring(map.rm_wait_time,4,6)}-${fn:substring(map.rm_wait_time,6,8)} ${fn:substring(map.rm_wait_time,8,10)}:${fn:substring(map.rm_wait_time,10,12)}</td>
		<td align="center">
			<c:if test="${!empty map.sc_dt && ''!=map.sc_dt }">
				완.${fn:substring(map.sc_dt,0,4)}-${fn:substring(map.sc_dt,4,6)}-${fn:substring(map.sc_dt,6,8)} ${fn:substring(map.sc_dt,8,10)}:${fn:substring(map.sc_dt,10,12)}
			</c:if>
			<c:if test="${!empty map.cc_sc_dt && ''!=map.cc_sc_dt }">
				취.${fn:substring(map.cc_sc_dt,0,4)}-${fn:substring(map.cc_sc_dt,4,6)}-${fn:substring(map.cc_sc_dt,6,8)} ${fn:substring(map.cc_sc_dt,8,10)}:${fn:substring(map.cc_sc_dt,10,12)}
			</c:if>
			
		</td>
	</tr>
		</c:if>

	</c:forEach>
</c:if>
</table>
<br>
${pageHtml }
